package com.lhq.tag_tales.utils;

import com.lhq.tag_tales.model.domain.User;

/**
 * 用户工具类
 * 用来获取当前线程的用户登录态
 */
public class UserUtils {
    private static final ThreadLocal<User> tl = new ThreadLocal<>();

    public static User getCurrentUser() {
        return tl.get();
    }

    public static void setCurrentUser(User user) {
        tl.set(user);
    }

    public static void removeCurrentUser() {
        tl.remove();
    }
}
